namespace GemBox.Spreadsheet
{
    using System;

    public class AnchorCell
    {
        private ExcelColumn column;
        private long columnOffset;
        private ExcelRow row;
        private long rowOffset;

        internal AnchorCell()
        {
        }

        public AnchorCell(AnchorCell anchorCell)
        {
            this.Column = anchorCell.Column;
            this.ColumnOffset = anchorCell.ColumnOffset;
            this.Row = anchorCell.Row;
            this.RowOffset = anchorCell.RowOffset;
        }

        public AnchorCell(ExcelColumn column, ExcelRow row, bool topLeft)
        {
            this.Column = column;
            this.Row = row;
            if (topLeft)
            {
                this.ColumnOffset = 0L;
                this.RowOffset = 0L;
            }
            else
            {
                this.columnOffset = (long) (this.Column.Width * 270.0);
                this.RowOffset = (long) (this.Row.Height * 592.0);
            }
        }

        public AnchorCell(ExcelColumn column, ExcelRow row, long columnOffset, long rowOffset)
        {
            this.column = column;
            this.row = row;
            this.columnOffset = columnOffset;
            this.rowOffset = rowOffset;
        }

        public override bool Equals(object obj)
        {
            AnchorCell cell = (AnchorCell) obj;
            return (((this.Column == cell.Column) && (this.ColumnOffset == cell.ColumnOffset)) && ((this.Row == cell.Row) && (this.RowOffset == cell.RowOffset)));
        }

        public override int GetHashCode()
        {
            return (((this.Column.Index ^ ((int) this.ColumnOffset)) ^ this.Row.Index) ^ ((int) this.RowOffset));
        }

        public ExcelColumn Column
        {
            get
            {
                return this.column;
            }
            set
            {
                this.column = value;
            }
        }

        public long ColumnOffset
        {
            get
            {
                return this.columnOffset;
            }
            set
            {
                this.columnOffset = value;
            }
        }

        public ExcelRow Row
        {
            get
            {
                return this.row;
            }
            set
            {
                this.row = value;
            }
        }

        public long RowOffset
        {
            get
            {
                return this.rowOffset;
            }
            set
            {
                this.rowOffset = value;
            }
        }
    }
}
